/*
 * Copyright (C) 2011-2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * This file is auto-generated. DO NOT MODIFY!
 * The source Renderscript file: C:\Users\dvburg\Dropbox\Thesis\Anwendung\Pixelator\src\com\caguilar\android\filters\scripts\yuv2rgb.rs
 */
package com.caguilar.android.filters.scripts;

import android.renderscript.*;
import android.content.res.Resources;

/**
 * @hide
 */
public class ScriptC_yuv2rgb extends ScriptC {
    private static final String __rs_resource_name = "yuv2rgb";
    // Constructor
    public  ScriptC_yuv2rgb(RenderScript rs) {
        this(rs,
             rs.getApplicationContext().getResources(),
             rs.getApplicationContext().getResources().getIdentifier(
                 __rs_resource_name, "raw",
                 rs.getApplicationContext().getPackageName()));
    }

    public  ScriptC_yuv2rgb(RenderScript rs, Resources resources, int id) {
        super(rs, resources, id);
        __I32 = Element.I32(rs);
        __ALLOCATION = Element.ALLOCATION(rs);
        __U8_4 = Element.U8_4(rs);
    }

    private Element __ALLOCATION;
    private Element __I32;
    private Element __U8_4;
    private FieldPacker __rs_fp_ALLOCATION;
    private FieldPacker __rs_fp_I32;
    private final static int mExportVarIdx_imageWidth = 0;
    private int mExportVar_imageWidth;
    public synchronized void set_imageWidth(int v) {
        setVar(mExportVarIdx_imageWidth, v);
        mExportVar_imageWidth = v;
    }

    public int get_imageWidth() {
        return mExportVar_imageWidth;
    }

    private final static int mExportVarIdx_imageHeight = 1;
    private int mExportVar_imageHeight;
    public synchronized void set_imageHeight(int v) {
        setVar(mExportVarIdx_imageHeight, v);
        mExportVar_imageHeight = v;
    }

    public int get_imageHeight() {
        return mExportVar_imageHeight;
    }

    private final static int mExportVarIdx_yuvData = 2;
    private Allocation mExportVar_yuvData;
    public synchronized void set_yuvData(Allocation v) {
        setVar(mExportVarIdx_yuvData, v);
        mExportVar_yuvData = v;
    }

    public Allocation get_yuvData() {
        return mExportVar_yuvData;
    }

    private final static int mExportForEachIdx_root = 0;
    public void forEach_root(Allocation ain, Allocation aout) {
        // check ain
        if (!ain.getType().getElement().isCompatible(__U8_4)) {
            throw new RSRuntimeException("Type mismatch with U8_4!");
        }
        // check aout
        if (!aout.getType().getElement().isCompatible(__U8_4)) {
            throw new RSRuntimeException("Type mismatch with U8_4!");
        }
        // Verify dimensions
        Type tIn = ain.getType();
        Type tOut = aout.getType();
        if ((tIn.getCount() != tOut.getCount()) ||
            (tIn.getX() != tOut.getX()) ||
            (tIn.getY() != tOut.getY()) ||
            (tIn.getZ() != tOut.getZ()) ||
            (tIn.hasFaces() != tOut.hasFaces()) ||
            (tIn.hasMipmaps() != tOut.hasMipmaps())) {
            throw new RSRuntimeException("Dimension mismatch between input and output parameters!");
        }
        forEach(mExportForEachIdx_root, ain, aout, null);
    }

    private final static int mExportFuncIdx_convert = 0;
    public void invoke_convert(Script script, Allocation inAllocation, Allocation outAllocation) {
        FieldPacker convert_fp = new FieldPacker(12);
        convert_fp.addObj(script);
        convert_fp.addObj(inAllocation);
        convert_fp.addObj(outAllocation);
        invoke(mExportFuncIdx_convert, convert_fp);
    }

}

